//
//  GroupInfoCellNew.m
//  NtoccShipper
//
//  Created by mac on 2020/6/10.
//  Copyright © 2020 zhuchongjin. All rights reserved.
//

#import "GroupInfoCellNew.h"
#import "HCSStarRatingView.h"

@interface GroupInfoCellNew()
@property (nonatomic,strong) HCSStarRatingView *viewRate;
@property (nonatomic,strong)  UIView *viewStar;
@property (nonatomic,strong)  UIImageView *imgVDriver;
@property (nonatomic,strong)  UILabel *labName;
@property (nonatomic,strong)  UILabel *labStarNum;
@property (nonatomic,strong)  UILabel *labCarType;
@property (nonatomic,strong)  UILabel *labCarNum;
@property (nonatomic,strong)  UILabel *labCarState;
@property (nonatomic,strong)  UILabel *lanWeight;
@property (nonatomic,strong) UIView *viewData;
@end

@implementation GroupInfoCellNew

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setCellInfoWithModel:(GroupInfoModel *)model{
    
    [self.viewStar addSubview:self.viewRate];
    _viewRate.value = model.avgBasicGrade;
    [self.imgVDriver sd_setImageWithURL:[NSURL URLWithString:model.headImg] placeholderImage:[UIImage imageNamed:@"zcj_default_person_icon"]];
    self.labName.text = model.driverName;
    self.labStarNum.text = CJStringWithFormat(@"%0.1f",model.avgBasicGrade);
    self.labCarType.text = model.classificationCodeName;
    self.labCarNum.text = model.licenseNumber;
    if (model.loadStatus == 0) {
        self.labCarState.textColor = [UIColor cjMainColorText];
    }else if (model.loadStatus == 1){
        self.labCarState.textColor = [UIColor cjRedColor];
    }
    self.labCarState.text = model.loadStatusName;
    if (model.loadWeight == 0) {
        self.lanWeight.text = @"承载:0吨";
    }else{
        self.lanWeight.text =  CJStringWithFormat(@"承载:%@吨",@(model.loadWeight).cj_description);
    }
    
    if ([CJControl getIsEmpty:model.loadStatusName] ) {
        self.viewData.hidden = YES;
    }else{
        self.viewData.hidden = NO;
    }

}

- (void)btnTouchViewDelecteAction{
    if (self.blockDelete) {
        self.blockDelete(@"");
    }
}

//- (HCSStarRatingView *)viewRate{
//    if (!_viewRate) {
//      _viewRate =   [[HCSStarRatingView alloc]initWithFrame:CGRectMake(0,0,self.viewStar.width ,self.viewStar.height)];
//        _viewRate.tintColor = [UIColor cjStarRateColor]; //
//        _viewRate.starBorderColor = [UIColor cjClearColor];
//        _viewRate.emptyStarColor = [UIColor cjEmptyStarRateColor];
//        _viewRate.backgroundColor = [UIColor cjClearColor];
//        _viewRate.enabled = NO;
//        _viewRate.maximumValue = 5;
//        _viewRate.minimumValue = 0;
//    }
//    return  _viewRate;
//}

- (HCSStarRatingView *)viewRate{
    if (!_viewRate) {
      _viewRate =   [[HCSStarRatingView alloc]initWithFrame:CGRectMake(0,0,110,30)];
        _viewRate.tintColor = [UIColor cjStarRateColor];
        _viewRate.starBorderColor = [UIColor cjClearColor];
        _viewRate.emptyStarColor = [UIColor cjEmptyStarRateColor];
        _viewRate.backgroundColor = [UIColor cjClearColor];
        _viewRate.enabled = NO;
        _viewRate.maximumValue = 5;
        _viewRate.minimumValue = 0;
        _viewRate.allowsHalfStars = YES;
    }
    return  _viewRate;
}


@end
